<template>
    <div>
        <el-dialog
            title="一键巡检报告"
            :visible.sync="dialogVisible"
            width="90%"
            :before-close="dialogClick"
            @open="initData"
            @close="dialogClose"
            :destroy-on-close=true
           
            
        >
            <div class="dialogBox">
             <component :is="currentTabComponent" :info='info' v-if="dialogVisible" ></component>
             <!-- v-if="dialogVisible" -->
                
            </div>
            <span slot="footer" class="dialog-footer">
                
                <el-button type="primary" @click="dialogClick">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import bus from "common/bus.js";
import vOutPdf from "@/components/common/outPdf/outPdf";
import vCard from "@/components/common/outPdf/card";
import vDataBase from './TEDatabaseDialog.vue'
import vSever from './dialogServer'
// import {htmlToBlob} from '@/api/index'

import moment from "moment";
export default {
    props: {
        dialogVisible: Boolean,
        itemType: String,
        dialogData: Array,
        title: String,
        info: null,
        
    },
    components: {
        vOutPdf,
        vCard,
        vDataBase,
        vSever
    },
    created() {},
    
    data() {
        return {
            
            loadings: false,
            serverInfo: [],
            cpuInfo: "",
            osInfo: "",
            fileInfo: "",
            type: "",
            currentTabComponent:'',
            requestData: {
                time: "2008-08-08 20:00:00",
                time2: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                ip: '',
            },
			
        };
    },
    methods: {
        dialogClick() {
            this.$emit("haldDialogfalse");
        },

        initData() {
            this.currentTabComponent=this.info.type=='DataBase'?'vDataBase':'vSever'
        },
        dialogClose(){
            this.$emit("haldDialogfalse");
            this.$router.push(this.$route)
        }
      
    },
};
</script>
<style scoped>
.dialogBox {
    display: grid;
    grid-template-rows: auto;
    row-gap: 40px;
}
a {
    text-decoration: none;
    color: #909399;
}
.box-card {
    margin: 10px;
}
</style>
